package br.unb.mestrado.simulator.model.simulator.formula;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import br.unb.mestrado.simulator.model.monitoring.State;
import br.unb.mestrado.simulator.model.simulator.SplSpecification;

public class QualityFormula {

	protected Integer id;
	protected Boolean enabled = false;
	protected Boolean approved = false;
	protected Map<State, List<SplSpecification>> spls;
	
	
	public QualityFormula() {
		super();
	}
	public QualityFormula(Integer id) {
		super();
		this.id = id;
	}
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	public Boolean getApproved() {
		return approved;
	}
	public void setApproved(Boolean approved) {
		this.approved = approved;
	}

	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		QualityFormula other = (QualityFormula) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}
	
	public void add(State state, SplSpecification spl){
		if(spls==null){
			this.spls = new HashMap<State,List<SplSpecification>>();
		}
		if(!this.spls.containsKey(state)){
			this.spls.put(state,new ArrayList<SplSpecification>());
		}
		this.spls.get(state).add(spl);
	}

	
	
	public Map<State, List<SplSpecification>> getSpls() {
		if(spls==null){
			this.spls = new HashMap<State,List<SplSpecification>>(); 
		}
		return spls;
	}
	public Boolean getEnabled() {
		return enabled;
	}
	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}
	
	
	
}
